package cn.xy.third.sms.email;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * 邮件发送配置
 *
 *  
 */
@Data
@Component
@ConfigurationProperties("email")
public class EmailConfig {

    private String host;

    private Integer port;

    private String form;

    private String user;

    private String pass;

    private List<EmailTemplate> templateList;

    public EmailTemplate getTemplateByName(String name) {
        return templateList.stream().filter(t -> t.getTemplateName().equals(name)).findFirst().orElse(null);
    }
}
